﻿using System;
class GCDEuclideanStyle
{
    static void Main()
    {
        int numbera;
        int numberb;
        int remain;
        Console.WriteLine("Please enter two numbers: ");
        while (true)
        {
            try
            {
                numbera = int.Parse(Console.ReadLine());
                break;
            }
            catch (Exception)
            {
                Console.Write("Please re-enter number one: ");
            }
        }
        while (true)
        {
            try
            {
                numberb = int.Parse(Console.ReadLine());
                break;
            }
            catch (Exception)
            {
                Console.Write("Please re-enter number two: ");
            }
        }
        Console.Write("GCD of {0} and {1} is: ", numbera, numberb);
        if (numberb > numbera)
        {
            numberb = (numbera + numberb) - (numbera = numberb);
        }
        do
        {
            remain = (numbera % numberb);
            numbera = numberb;
            numberb = remain;
        } while (numberb != 0);
        Console.WriteLine(numbera);
        Console.ReadLine();
    }
}

